package o;

import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable;
import o.zj.b;

public class zs implements zj, zm {
    @GuardedBy("requestLock")
    private boolean ʻ;
    @GuardedBy("requestLock")
    private b ʽ = b.CLEARED;
    @Nullable
    private final zj ˊ;
    private volatile zm ˋ;
    private final Object ˎ;
    @GuardedBy("requestLock")
    private b ˏ = b.CLEARED;
    private volatile zm ॱ;

    public zs(Object obj, @Nullable zj zjVar) {
        this.ˎ = obj;
        this.ˊ = zjVar;
    }

    public void ˊ(zm zmVar, zm zmVar2) {
        this.ॱ = zmVar;
        this.ˋ = zmVar2;
    }

    public boolean ˎ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ʽ() && (zmVar.equals(this.ॱ) || this.ˏ != b.SUCCESS);
        }
        return z;
    }

    @GuardedBy("requestLock")
    private boolean ʽ() {
        return this.ˊ == null || this.ˊ.ˎ(this);
    }

    public boolean ˋ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ᐝ() && zmVar.equals(this.ॱ) && !ॱˊ();
        }
        return z;
    }

    public boolean ˊ(zm zmVar) {
        boolean z;
        synchronized (this.ˎ) {
            z = ʻ() && zmVar.equals(this.ॱ) && this.ˏ != b.PAUSED;
        }
        return z;
    }

    @GuardedBy("requestLock")
    private boolean ʻ() {
        return this.ˊ == null || this.ˊ.ˊ(this);
    }

    @GuardedBy("requestLock")
    private boolean ᐝ() {
        return this.ˊ == null || this.ˊ.ˋ(this);
    }

    public boolean ʼ() {
        boolean z;
        synchronized (this.ˎ) {
            z = ˏॱ() || ॱˊ();
        }
        return z;
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void ॱ(o.zm r3) {
        /*
        r2 = this;
        r1 = r2.ˎ;
        monitor-enter(r1);
        r0 = r2.ˋ;	 Catch:{ all -> 0x002d }
        r0 = r3.equals(r0);	 Catch:{ all -> 0x002d }
        if (r0 == 0) goto L_0x0011;
    L_0x000b:
        r0 = o.zj.b.SUCCESS;	 Catch:{ all -> 0x002d }
        r2.ʽ = r0;	 Catch:{ all -> 0x002d }
        monitor-exit(r1);	 Catch:{ all -> 0x002d }
    L_0x0010:
        return;
    L_0x0011:
        r0 = o.zj.b.SUCCESS;	 Catch:{ all -> 0x002d }
        r2.ˏ = r0;	 Catch:{ all -> 0x002d }
        r0 = r2.ˊ;	 Catch:{ all -> 0x002d }
        if (r0 == 0) goto L_0x001e;
    L_0x0019:
        r0 = r2.ˊ;	 Catch:{ all -> 0x002d }
        r0.ॱ(r2);	 Catch:{ all -> 0x002d }
    L_0x001e:
        r0 = r2.ʽ;	 Catch:{ all -> 0x002d }
        r0 = r0.ˋ();	 Catch:{ all -> 0x002d }
        if (r0 != 0) goto L_0x002b;
    L_0x0026:
        r0 = r2.ˋ;	 Catch:{ all -> 0x002d }
        r0.ॱ();	 Catch:{ all -> 0x002d }
    L_0x002b:
        monitor-exit(r1);	 Catch:{ all -> 0x002d }
        goto L_0x0010;
    L_0x002d:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x002d }
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.zs.ॱ(o.zm):void");
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public void ʽ(o.zm r3) {
        /*
        r2 = this;
        r1 = r2.ˎ;
        monitor-enter(r1);
        r0 = r2.ॱ;	 Catch:{ all -> 0x0020 }
        r0 = r3.equals(r0);	 Catch:{ all -> 0x0020 }
        if (r0 != 0) goto L_0x0011;
    L_0x000b:
        r0 = o.zj.b.FAILED;	 Catch:{ all -> 0x0020 }
        r2.ʽ = r0;	 Catch:{ all -> 0x0020 }
        monitor-exit(r1);	 Catch:{ all -> 0x0020 }
    L_0x0010:
        return;
    L_0x0011:
        r0 = o.zj.b.FAILED;	 Catch:{ all -> 0x0020 }
        r2.ˏ = r0;	 Catch:{ all -> 0x0020 }
        r0 = r2.ˊ;	 Catch:{ all -> 0x0020 }
        if (r0 == 0) goto L_0x001e;
    L_0x0019:
        r0 = r2.ˊ;	 Catch:{ all -> 0x0020 }
        r0.ʽ(r2);	 Catch:{ all -> 0x0020 }
    L_0x001e:
        monitor-exit(r1);	 Catch:{ all -> 0x0020 }
        goto L_0x0010;
    L_0x0020:
        r0 = move-exception;
        monitor-exit(r1);	 Catch:{ all -> 0x0020 }
        throw r0;
        */
        throw new UnsupportedOperationException("Method not decompiled: o.zs.ʽ(o.zm):void");
    }

    @GuardedBy("requestLock")
    private boolean ˏॱ() {
        return this.ˊ != null && this.ˊ.ʼ();
    }

    public void ˏ() {
        synchronized (this.ˎ) {
            this.ʻ = true;
            try {
                if (!(this.ˏ == b.SUCCESS || this.ʽ == b.RUNNING)) {
                    this.ʽ = b.RUNNING;
                    this.ˋ.ˏ();
                }
                if (this.ʻ && this.ˏ != b.RUNNING) {
                    this.ˏ = b.RUNNING;
                    this.ॱ.ˏ();
                }
                this.ʻ = false;
            } catch (Throwable th) {
                this.ʻ = false;
            }
        }
    }

    public void ॱ() {
        synchronized (this.ˎ) {
            this.ʻ = false;
            this.ˏ = b.CLEARED;
            this.ʽ = b.CLEARED;
            this.ˋ.ॱ();
            this.ॱ.ॱ();
        }
    }

    public void ˊ() {
        synchronized (this.ˎ) {
            if (!this.ʽ.ˋ()) {
                this.ʽ = b.PAUSED;
                this.ˋ.ˊ();
            }
            if (!this.ˏ.ˋ()) {
                this.ˏ = b.PAUSED;
                this.ॱ.ˊ();
            }
        }
    }

    public boolean ˋ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˏ == b.RUNNING;
        }
        return z;
    }

    public boolean ˎ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˏ == b.SUCCESS;
        }
        return z;
    }

    private boolean ॱˊ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˏ == b.SUCCESS || this.ʽ == b.SUCCESS;
        }
        return z;
    }

    public boolean ॱॱ() {
        boolean z;
        synchronized (this.ˎ) {
            z = this.ˏ == b.CLEARED;
        }
        return z;
    }

    public boolean ˏ(zm zmVar) {
        if (!(zmVar instanceof zs)) {
            return false;
        }
        zs zsVar = (zs) zmVar;
        if (this.ॱ == null) {
            if (zsVar.ॱ != null) {
                return false;
            }
        } else if (!this.ॱ.ˏ(zsVar.ॱ)) {
            return false;
        }
        if (this.ˋ == null) {
            if (zsVar.ˋ != null) {
                return false;
            }
        } else if (!this.ˋ.ˏ(zsVar.ˋ)) {
            return false;
        }
        return true;
    }
}
